import { Spin } from 'antd';
import { memo } from 'react';
import styles from './index.module.scss';
const BasicLoading = ({
	spinning = false,
	fullscreen = true,
	tip = '加载中...',
	children,
	...props
}) => {
	if (fullscreen) {
		return (
			<>
				{children}
				<Spin
					spinning={spinning}
					tip={tip}
					fullscreen
					{...props}
					className={styles.loadingWrapper}
				/>
			</>
		);
	}
	return (
		<div className={styles.loadingWrapper}>
			<Spin spinning={spinning} tip={tip} {...props}>
				{children}
			</Spin>
		</div>
	);
};
export default memo(BasicLoading);
